feat(brainstormer): forge-loop brainstorm CLI (dry-run + --apply) (#124)#145
Merged
Merged
Conversation
New `forge-loop brainstorm` subcommand wires the existing Brainstormer (issue #122) and GhClient (issue #83/#123) into an operator-facing CLI. Behavior: * No flags → discover ProductVision, run Brainstormer, dump the BrainstormReport as YAML to stdout. Zero GitHub calls. * --apply → file proposed epics first (labels: axis:<name> + epic), then file proposed tickets (labels: axis:<name> + loop:ready) with `Parent: #<epic-number>` cross-link bodies threading the returned epic numbers. * Missing/invalid ProductVision → exit 2 with a clear stderr line and no partial state. * Partial failure during --apply → exit 1; successful issues are reported on stdout (with their numbers), failures with title + error are reported on stderr. * --apply is opt-in; default never writes. Why opt-in matters: without a hard default-dry-run, a stray `forge-loop brainstorm` would file epics + tickets against whatever repo `LOOP_GH_REPO` points at — which is exactly the failure mode the spec is defending against. Supporting change to gh_client (#83 framework): adds `create_issue` to the GhClient Protocol + GithubkitClient + MockGhClient. The protocol previously covered only reads + label edits; the brainstorm CLI is the first writer call site, so the method ships alongside. MockGhClient gets `create_issue_responses` / `next_issue_number` / `raise_on_create_titles` knobs so tests can pre-stage epic numbers and inject per-title failure. Tests (tests/test_cli_brainstorm.py): full acceptance matrix from the issue — dry-run YAML shape, epics-filed-first ordering with parent cross-link, epic+ticket label contracts, missing/invalid vision exits, partial-failure exit-1 with per-title reporting, empty-report no-op, and an adversarial "default never writes" test that catches a future regression flipping --apply on by default. Also registers `brainstorm` in the existing test_cli.py help-list smoke test so future help-regressions surface early.
Owner
Author
|
Source issue #124 was closed mid-flight (state: closed). Loop refusing auto-merge. Reopen the issue OR merge manually. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #124.
Summary
New
forge-loop brainstormsubcommand that wires the existingBrainstormer(#122) andGhClient(#83/#123) into an operator-facing CLI. Dry-run by default;--applyfiles epics + tickets.Acceptance criteria coverage
BrainstormReportas YAML, no GitHub callstest_brainstorm_dry_run_prints_yaml--applyfiles epics first, threadsParent: #<n>into ticketstest_brainstorm_apply_files_epics_firstaxis:<name>+epictest_brainstorm_apply_labels_epicaxis:<name>+loop:readytest_brainstorm_apply_labels_ticketProductVision→ exit 2test_brainstorm_missing_vision_exits_2ProductVision(empty axes) → exit 2test_brainstorm_invalid_vision_exits_2test_brainstorm_partial_failure_exits_1create_issuecallstest_brainstorm_apply_no_proposals--applyis opt-in, never defaulttest_brainstorm_default_never_writes(adversarial)apptest_cli.pyhelp-list smoke test now includesbrainstormSupporting change
gh_client.pygainscreate_issueon theGhClientProtocol,GithubkitClient, andMockGhClient. The brainstorm CLI is the first writer call site, so the method ships alongside.MockGhClientgetscreate_issue_responses/next_issue_number/raise_on_create_titlesknobs so tests can pre-stage epic numbers and inject per-title failures.Test plan
pytest tests/test_cli_brainstorm.py— 9 passedpytest tests/test_cli.py tests/test_brainstormer.py tests/test_gh_client.py— 59 passed🤖 Generated with Claude Code